<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>
<link href="__PUBLIC__/admin/sncss/css/style.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="__PUBLIC__/admin/sncss/js/jquery.js"></script>
<link href="__PUBLIC__/admin/sncss/css/combo.select.css" rel="stylesheet" type="text/css" />
</head>
<body>
	<div class="place">
		<span>位置：</span>
		<ul class="placeul">
		<li><a>首页</a></li>
		<li><a>工单管理</a></li>
		<li><a>工单列表</a></li>
		</ul>
		</div>

		<div class="rightinfo">
		<div class="tools">

		<form id="form1" name="form1" method="get" action="{:U('/Home/Workorder/workorder_list')}">
			<div style="float: left;">
				<select class="newselect" id="u2_input" name="state" >
					<option selected value="0">请选择</option>
					<option  value="1" <?php if($state == 1){echo "selected='selected'";}?>>待确认</option>
					<option  value="2" <?php if($state == 2){echo "selected='selected'";}?>>已确认待处理</option>
					<option  value="3" <?php if($state == 3){echo "selected='selected'";}?>>已处理</option>
				</select>
			</div>
			<div style="float: left;">
				<select class="newselect" id="u3_input" name="department" >
					<option selected value="0">请选择</option>
					<option  value="1" <?php if($department == 1){echo "selected='selected'";}?>>管理员</option>
					<option  value="3" <?php if($department == 3){echo "selected='selected'";}?>>市场部</option>
					<option  value="4" <?php if(￥department == 4){echo "selected='selected'";}?>>运营部</option>
				</select>
			</div>
			<div style="float: left; margin-bottom: 15px;">
				<input name="keyword" style="height: 38px;" type="text" class="dfinput" placeholder="工单名称" id="keyword" value="<?php echo $keyword;?>" />
			</div>
			<div style="float: left; margin-bottom: 15px;">
				<input name="" style="height: 40px;" type="submit" class="btn" value="搜索"/>
			</div>
		</form>

		</div>
		<table class="tablelist">
			<thead>
			<tr>
				<th>编号<i class="sort"><img src="__PUBLIC__/admin/sncss/images/px.gif" /></i></th>
				<th>工单名称</th>
				<th>工单内容</th>
				<th>指派部门</th>
				<th>工单状态</th>
				<th>创建人昵称</th>
				<th>确认人</th>
				<th>处理时间</th>
				<th>操作</th>
				</tr>
				</thead>
				<tbody>

		<foreach name='workorder_list' item='v'>
				<tr>
				<td>{$v.id}</td>
				<td>{$v.workorder_name}</td>
				<td>{$v.workorder_content}</td>
				<td>
					<switch name="v.department" >
						<case value="0">管理员</case>
						<case value="3">市场部</case>
						<case value="4">运营部</case>
						<default />未知
					</switch>
				</td>
					<td>
						<switch name="v.workorder_status" >
							<case value="1">待确定</case>
							<case value="2">已确定待处理</case>
							<case value="3">已处理</case>
							<default />未知
						</switch>
					</td>
				<td>
					{$v.nickname}<br>{$v.add_time}

				</td>
				<td>{$v.confirm_name}<br><notempty name="v.confirm_time">{$v.confirm_time}</notempty></td>
				<td><notempty name="v.remark_time">{$v.remark_time}</notempty></td>
				<td>
					<if condition="$v.workorder_status eq 1 && ($founder eq $v.department || $founder eq 1)" >
						<a href="{:U('/Home/Workorder/order_confirm',array('workorder_id'=>$v['id']))}" class="tablelink">确认</a>&nbsp;
					<elseif condition="$v.workorder_status eq 2 && ($founder eq $v.department || $founder eq 1)" />
						<a class="tablelink" onclick="add_remark('{$v.id}')">完成并备注</a>&nbsp;
						<elseif condition="$v.workorder_status eq 3" />
						<a class="tablelink" onclick="see_remark('{$v.remark}')">查看处理结果</a>&nbsp;
					</if>
				</td>
				</tr>
			 </foreach>
				</tbody>
		</table>
		<style>.pages a,.pages span {
		display:inline-block;
		padding:2px 5px;
		margin:0 1px;
		border:1px solid #f0f0f0;
		-webkit-border-radius:3px;
		-moz-border-radius:3px;
		border-radius:3px;
}
.pages a,.pages li {
		display:inline-block;
		list-style: none;
		text-decoration:none; color:#58A0D3;
}
.pages a.first,.pages a.prev,.pages a.next,.pages a.end{
		margin:0;
}
.pages a:hover{
		border-color:#50A8E6;
}
.pages span.current{
		background:#50A8E6;
		color:#FFF;
		font-weight:700;
		border-color:#50A8E6;
}</style>

	 <div class="pages"><br />

												<div align="right">{$page}
												</div>
	 </div>

		</div>



</body>
<script src="__PUBLIC__/admin/Js/jquery-1.7.2.min.js"></script>
<script src="__PUBLIC__/admin/Js/jquery.combo.select.js"></script>
<script type="text/javascript">
	$('.tablelist tbody tr:odd').addClass('odd');
	$(function() {
		$('#u1_input').comboSelect();
		$('#u2_input').comboSelect();
		$('#u3_input').comboSelect();
		$('#u4_input').comboSelect();
	});
</script>
<script src="__PUBLIC__/layer/layer.js"></script>

<script type="text/javascript">
	function add_remark(workorder_id) {
        layer.open({title: false, type: 1, area: ['400px', '220px'], //宽高
            content: '<div class="mainlist" style="padding:30px;"><form id="form2" name="form2" method="post" action="/Home/Workorder/order_remark" onsubmit="return form2_submit();">'
            +'备注:<br>'
            +'<textarea style="width: 300px; height: 100px" id="remark" name="remark" class="lginput" autofocus="autofocus" ></textarea>'
            +'<input name="workorder_id" type="hidden" value="'+workorder_id+'" />'
            +'<br><br><input type="submit" class="btn" value="确认"/></form></div>'
        });
    }
    function see_remark(remark) {
        layer.open({title: false, type: 1, area: ['400px', '220px'], //宽高
            content: '<div class="mainlist" style="padding:30px;">'
            +'备注:<br>'
            +'<textarea style="width: 300px; height: 100px" id="see_remark" name="see_remark" class="lginput" autofocus="autofocus"  readonly="readonly" >'+remark+'</textarea>'
        });
    }
    function form2_submit(){
        var remark= $('#remark').val();
        if(remark.length==0){
            alert('备注不能为空');return false;
        }
    }
</script>
</html>
